#include "bm_fsm.h"
#include "stdint.h"
#include "bm_debug.h"
#include "gpio.h"
//#include "bm_bike.h"

#define LED_ON  0
#define LED_OFF 1

static uint8_t fsm_timer;

void fsm_timeout_handler_t(uint32_t context)
{
	if(context == LED_ON)
	{
		BM_GPIO_PIN_SET(LED1);
		soft_timer_start(fsm_timer,5000 ms,LED_OFF);
	}
	else{
		BM_GPIO_PIN_CLEAR(LED1);
		soft_timer_start(fsm_timer,5000 ms,LED_ON);
	}
}

void bm_fsm_init(void)
{
	soft_timer_create(&fsm_timer,MODE_ONE_SHOT,fsm_timeout_handler_t);
	soft_timer_start(fsm_timer,125,LED_ON);
}
